import request from "@/utils/request";
import type { ResponseData } from "./type.ts";

enum API {
  GetWords = "/words",
}

export interface WordsResponseData extends ResponseData {
    data: string[]
}
export const getWords = () => {
  return request.get<any, WordsResponseData>(API.GetWords);
};

export interface WordDetail {
    word: string
    speech: string
    intro: string
}

export interface Sentence {
    word: string
    sentence: string
    trans: string
}

export interface WordDetailResponseData extends ResponseData {
    data: {
      wordDetails : WordDetail[],
      sentences : Sentence[],
      tags : string[]
    }
}
export const getWordDetail = (word: string) => {
  return request.get<any, WordDetailResponseData>(API.GetWords + "/" + word);
};